﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page/Site.Master" AutoEventWireup="true" EnableEventValidation ="false" CodeBehind="Order.aspx.cs" Inherits="ERP.Page.Order" %>
<%@ MasterType VirtualPath="~/Page/Site.Master" %>
<%@ Register Src="~/PageUC/OrderUC.ascx" TagPrefix="uc1" TagName="OrderUC" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<link href="../Content/chosen.css" rel="stylesheet" />
<script src="../Script/chosen.jquery.js"></script>
<script>
    function setSelectedValue(selectObj, valueToSet) {
        for (var i = 0; i < selectObj.options.length; i++) {
            if (selectObj.options[i].text == valueToSet) {
                selectObj.options[i].selected = true;
                return;
            }
        }
    }
    function DetailRows(x) {
        //gets table

        var getTable = document.getElementById('MyTable');
        //gets cells of current row  
        var getCells = getTable.rows.item(x.rowIndex).cells;

        document.getElementById('<%=OrderUC.txtChungTu.ClientID %>').disabled = true;
        //document.getElementById('<%=OrderUC.btnMaterialsDetail.ClientID %>').style.display = "inherit";
        document.getElementById('<%=OrderUC.btnAddMaterials_Popup.ClientID %>').style.display = "none";
        
        document.getElementById('<%=OrderUC.txtTenKhachHang.ClientID %>').value = getCells.item(2).innerHTML;
        document.getElementById('<%=OrderUC.txtChungTu.ClientID %>').value = getCells.item(3).innerHTML;
        document.getElementById('<%=OrderUC.txtNgayDatHang.ClientID %>').value = getCells.item(4).innerHTML;
        document.getElementById('<%=OrderUC.txtNgayGiaoHang.ClientID %>').value = getCells.item(5).innerHTML;
            
        document.getElementById('<%=OrderUC.txtHangThanhToan.ClientID %>').value = getCells.item(6).innerHTML;
        document.getElementById('<%=OrderUC.txtVAT.ClientID %>').value = getCells.item(7).innerHTML;
        document.getElementById('<%=OrderUC.txtGiaVanChuyen.ClientID %>').value = getCells.item(8).innerHTML;
        document.getElementById('<%=OrderUC.txtDienGiai.ClientID %>').value = getCells.item(9).innerHTML;
        document.getElementById('<%=OrderUC.hdMaKH.ClientID %>').value = getCells.item(10).innerHTML;
        document.getElementById('<%=OrderUC.lbID.ClientID %>').value = getCells.item(11).innerHTML;
        document.getElementById('<%=OrderUC.txtDiaChi.ClientID %>').value = getCells.item(12).innerHTML;
        document.getElementById('<%=OrderUC.txtMaKhachHang.ClientID %>').value = getCells.item(13).innerHTML;
        document.getElementById('<%=OrderUC.txtDienGiai.ClientID %>').value = getCells.item(14).innerHTML;

        document.getElementById('<%=OrderUC.txtMaKhachHang.ClientID %>').disabled = true;
        document.getElementById('<%=OrderUC.txtTenKhachHang.ClientID %>').disabled = true;
        document.getElementById('<%=OrderUC.txtDiaChi.ClientID %>').disabled = true;
        $("#detailmaterials").dialog("open");
        }
    </script>
<script>
    function pageLoad() {
        //-------------------Tooltip-------------------
        Tooltip('.btn-add');
        Tooltip('.btn-delete');
        Tooltip('.btn-excel');
        Tooltip('.btn-search');
        Tooltip('.btn-reload');
        Tooltip('.btn-save');
        Tooltip('.btn');
        Tooltip('.text-num-order');
        Tooltip('.note');
        //--------------------Popup--------------------
        PopupUpdateHeight('#order');
        //PopupUpdate('#order');
        PopupUpdate('#materials');
        PopupUpdate('#customer');
        PopupUpdateHeight('#detailmaterials');
        //--------------------DatePicker--------------------
        DatePicker('.textbox_child_text_ngay');
        MarkInputDay('.textbox_child_text_ngay');

        //------------------TabletSort-----------------
        TableSort('#MyTable');
        TableSort('#MyTableMaterials');
        TableSort('#MyTableOrderDetail');
        TableSort('#MyTableCustomer');
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdatePanel ID="upDateAll" runat="server">
    <ContentTemplate>
        <!---------------Toolbar---------------->
            <div class="toolbar-main">
                <div class="btn-group">
                    <asp:LinkButton ID="btnAdd" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnAdd_Click"><i class="fa fa-pencil-square-o"></i> Thêm mới</asp:LinkButton>
                    <asp:LinkButton ID="btnDelete" CssClass="btn btn-default btn-sm" runat="server" OnClientClick="return confirmCheckIn(this)" OnClick="btnDelete_Click"><i class="fa fa-trash-o"></i> Xoá</asp:LinkButton>
                
                    <asp:LinkButton ID="btnActive" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnActive_Click"><i class="fa fa-check"></i> Xét duyệt</asp:LinkButton>
                    <asp:LinkButton ID="btnExcel" CssClass="btn btn-default btn-sm" runat="server"><i class="fa fa-file-excel-o"></i> Xuất file Excel</asp:LinkButton>
                </div>
            </div>
        <!---------------Toolbar---------------->
        <%=StrAlert %>
        <!----------------Loading---------------->
        <asp:UpdateProgress ID="upDateProcess" runat="server" AssociatedUpdatePanelID="upDateAll">
            <ProgressTemplate>
                <span style="text-align: center" class="label label-warning">Đang tải...</span>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <!--------------Kêt-thúc----------------->

        <div class="table-responsive">
            <asp:ListView ID="ListViewAll" runat="server" DataKeyNames="Order_Id" OnItemCommand="ListViewAll_ItemCommand" OnItemDataBound="ListViewAll_ItemDataBound">
                <LayoutTemplate>
                    <table id="MyTable" class="tablesorter">
                        <thead>
                            <tr>
                                <th style="text-align: center" data-sorter="false" data-filter="false">STT</th>
                                <th style="text-align: center" data-sorter="false" data-filter="false">
                                    <input type="checkbox" onchange="checkAll('#chkAll','chkList')" id="chkAll" />
                                </th>
                                <th style="text-align: center" class="filter-select" data-placeholder="--Lọc theo người đặt--">Người đặt hàng</th>
                                <th style="text-align: center" class="filter-select" data-placeholder="--Lọc theo chứng từ--">Chứng từ đặt</th>
                                <th style="text-align: center" data-filter="false">Ngày đặt</th>
                                <th style="text-align: center" data-filter="false">Ngày giao</th>
                                <th style="text-align: center" data-filter="false">Hạn thanh toán</th>
                                <th style="text-align: center" data-filter="false">Trạng thái</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </tbody>
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr runat="server"  class="warning">
                        <td style="text-align: center">
                            <%# Eval("Rows_ID") %>
                            <asp:Label ID="lbIDOrder_1" Visible="false" runat="server" Text='<%# Eval("Order_Id") %>'></asp:Label>
                        </td>
                        <td style="text-align: center">
                            <asp:CheckBox ClientIDMode="Static" ID="chkList" CssClass="chkList" runat="server" />
                        </td>
                        <td style="text-align:left">
                            <asp:LinkButton ID="link_Cus_Name" CssClass="note" CommandName="_ViewDetail" runat="server" Text='<%# Eval("Customer_Name") %>'></asp:LinkButton>
                        </td>
                        <td style="text-align:left">
                            <asp:LinkButton ID="link_Order_Code" CssClass="note" CommandName="_ViewDetail" runat="server" Text='<%# Eval("Order_Code") %>'></asp:LinkButton>
                        </td>
                        <td style="text-align:right">
                            <asp:LinkButton ID="link_DateBegin" CssClass="note" CommandName="_ViewDetail" runat="server" Text='<%# Eval("Order_DateBegin","{0:dd/MM/yyyy}") %>'></asp:LinkButton>
                        </td>
                        <td style="text-align:right">
                            <asp:LinkButton ID="link_DateEnd" CssClass="note" CommandName="_ViewDetail" runat="server" Text='<%# Eval("Order_DateEnd" ,"{0:dd/MM/yyyy}") %>'></asp:LinkButton>
                        </td>
                        <td style="text-align:right">
                            <asp:LinkButton ID="link_Payment_Date" CssClass="note" CommandName="_ViewDetail" runat="server" Text='<%# Eval("Order_Payment_Date","{0:dd/MM/yyyy}") %>'></asp:LinkButton>
                        </td>
                        <td style="text-align:left;display:none"><%# Eval("Order_VAT") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Order_Transport") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Order_Note") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Customer_Id") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Order_Id") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Customer_Address") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Customer_Alias") %></td>
                        <td style="text-align:left;display:none"><%# Eval("Order_Note") %></td>
                        <td style="display:none">
                            <asp:Label ID="lbIDOrder" runat="server" Text='<%# Eval("Order_Id") %>'></asp:Label>
                        </td>
                        <td style="text-align:center">
                            <asp:Label ID="lbStatus" runat="server" Text='<%# Eval("IsActive") %>'></asp:Label>
                        </td>
                        <td style="text-align:center;display:none">
                            <asp:LinkButton ID="btnViewDetail" CommandName="_ViewDetail" CssClass="btn btn-default btn-xs" runat="server">Xét duyệt</asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
                <EmptyDataTemplate>
                    <div class='alert alert-danger'>
                        <a href='#' class='close' data-dismiss='alert'>&times;</a>
                        Không tìm thấy mẫu tin nào !
                    </div>
                </EmptyDataTemplate>
            </asp:ListView>
            <div class="pager">
                <div class="toolbar-main">
                <asp:TextBox ID="txtSearch" CssClass="textbox-search" runat="server" />
                <asp:LinkButton ID="btnSearch" CssClass="btn btn-default btn-xs" title="Tìm kiếm" runat="server" OnClick="btnSearch_Click"><i class="fa fa-search"></i></asp:LinkButton>
                <asp:LinkButton ID="btnReload" CssClass="btn btn-default btn-xs" title="Làm tươi" runat="server" OnClick="btnReload_Click"><i class="fa fa-refresh"></i></asp:LinkButton>
                <span>Trang</span>
                    <select class="gotoPage" title="Select page number"></select>
                    <img src="../Content/TableSort/addons/pager/icons/first.png" class="first" alt="First" />
                    <img src="../Content/TableSort/addons/pager/icons/prev.png" class="prev" alt="Prev" />
                    <span class="pagedisplay"></span>
                    <img src="../Content/TableSort/addons/pager/icons/next.png" class="next" alt="Next" />
                    <img src="../Content/TableSort/addons/pager/icons/last.png" class="last" alt="Last" />
                </div>
            </div>
        </div>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnDelete" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
        <asp:AsyncPostBackTrigger ControlID="btnReload" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>

<!-------------Edit-Dữ-Liệu-------------->
<div id="order" title="Đặt mua hàng">
    <uc1:OrderUC runat="server" ID="OrderUC" />
</div>

<div id="materials" title="Thông tin vật tư">
    <asp:UpdatePanel ID="upDateMaterrials" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <div class="grid-materials">
                <asp:TextBox ID="txtSearchUC" CssClass="textbox_child_search" placeholder="Nhập vào từ khoá tìm kiếm..." runat="server" />
                <div class="btn-group">
                    <asp:LinkButton ID="btnSearchUC" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnSearchUC_Click"><i class="fa fa-search"></i> Tìm kiếm</asp:LinkButton>
                    <asp:LinkButton ID="btnReloadUC" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnReloadUC_Click"><i class="fa fa-refresh"></i> Làm tươi</asp:LinkButton>
                    <asp:LinkButton ID="btnAddMaterials" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnAddMaterials_Click"><i class="fa fa-pencil"></i> Chấp nhận</asp:LinkButton>
                </div>
                    
                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upDateMaterrials">
                    <ProgressTemplate>
                        <span class="label label-warning">Đang tải..</span>
                    </ProgressTemplate>
                </asp:UpdateProgress>
                <%=_StrAlert %>
                <div class="table-responsive">
                    <asp:ListView ID="ListViewAllMaterials" runat="server" DataKeyNames="Materials_Id">
                        <LayoutTemplate>
                            <table id="MyTableMaterials" class="tablesorter">
                                <thead>
                                    <tr>
                                        <th style="text-align: center" data-sorter="false" data-filter="false">STT</th>
                                        <th style="text-align: center" data-sorter="false" data-filter="false">
                                            #
                                        </th>
                                        <th style="text-align:center" class="filter-select" data-placeholder="--Chọn mã vật tư--">Mã vật tư</th>
                                        <th style="text-align:center" class="filter-select" data-placeholder="--Chọn tên vật tư--">Tên vật tư</th>
                                        <th style="text-align:center" class="filter-select" data-placeholder="--Chọn tên nhóm vật tư--">Tên nhóm vật tư</th>
                                        <th style="text-align:center" class="filter-select" data-placeholder="--Chọn đơn vị tính--">ĐVT</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr id="itemPlaceholder" runat="server">
                                    </tr>
                                </tbody>
                                <tfoot>
                                    <th style="text-align: center" colspan="14" class="ts-pager form-horizontal tablesorter-pager" data-column="0">
                                        <label>Trang</label>
                                        <select class="pagenum input-mini" aria-disabled="false">
                                        </select>
                                        <button type="button" class="btn btn-xs first disabled" tabindex="0" aria-disabled="true"><i class="icon-step-backward glyphicon glyphicon-step-backward"></i></button>
                                        <button type="button" class="btn btn-xs prev disabled" tabindex="0" aria-disabled="true"><i class="icon-arrow-left glyphicon glyphicon-backward"></i></button>
                                        <span class="pagedisplay"></span>
                                        <button type="button" class="btn btn-xs next" tabindex="0" aria-disabled="false"><i class="icon-arrow-right glyphicon glyphicon-forward"></i></button>
                                        <button type="button" class="btn btn-xs last" tabindex="0" aria-disabled="false"><i class="icon-step-forward glyphicon glyphicon-step-forward"></i></button>
                                    </th>
                                </tfoot>
                            </table>
                        </LayoutTemplate>
                        <ItemTemplate>
                            <tr runat="server" class="warning">
                                <td style="text-align: center"><%# Eval("Materials_Id") %></td>
                                <td style="text-align: center">
                                    <asp:CheckBox ClientIDMode="Static" ID="chkListOrderTemp" runat="server" />
                                </td>
                                <td><%# Eval("Materials_Alias") %></td>
                                <td><%# Eval("Materials_Name") %></td>
                                <td><%# Eval("Materials_Type_Name") %></td>
                                <td style="text-align:center"><%# Eval("Unit_Name") %></td>
                            </tr>
                        </ItemTemplate>
                        <EmptyDataTemplate>
                            <div class='alert alert-danger'>
                                <a href='#' class='close' data-dismiss='alert'>&times;</a>
                                Không tìm thấy mẫu tin nào !
                            </div>
                        </EmptyDataTemplate>
                    </asp:ListView>
                </div>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearchUC" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnReloadUC" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnAddMaterials" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</div>

<div id="customer" title="Thông tin khách hàng">
    <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
             <div class="grid-materials">
                 <asp:TextBox ID="txtSearchCustomer" CssClass="textbox_child_search" placeholder="Nhập vào từ khoá tìm kiếm..." runat="server" />
                 <div class="btn-group">
                    <asp:LinkButton ID="btnSearchCustomer" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnSearchCustomer_Click"><i class="fa fa-search"></i> Tìm kiếm</asp:LinkButton>
                    <asp:LinkButton ID="btnReloadCustomer" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnReloadCustomer_Click"><i class="fa fa-refresh"></i> Làm tươi</asp:LinkButton>
                </div>

                 <asp:UpdateProgress ID="upDateProcessUCustomer" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
                    <ProgressTemplate>
                        <span class="label label-warning">Đang tải..</span>
                    </ProgressTemplate>
                </asp:UpdateProgress>
                 <%=_StrAlertCus %>
                 <div class="table-responsive">
                      <asp:ListView ID="ListViewAllCustomer" runat="server" DataKeyNames="Customer_ID" OnItemCommand="ListViewAllCustomer_ItemCommand">
                          <LayoutTemplate>
                                <table id="MyTableCustomer" class="tablesorter">
                                    <thead>
                                        <tr>
                                            <th style="text-align: center" data-sorter="false" data-filter="false">STT</th>
                                            <th style="text-align:center" class="filter-select" data-placeholder="--Chọn mã KH--">Mã KH</th>
                                            <th style="text-align:center" class="filter-select" data-placeholder="--Chọn tên KH--">Tên KH</th>
                                            <th style="text-align:center" class="filter-select" data-placeholder="--Chọn số ĐT-">Số ĐT</th>
                                            <th style="text-align:center" class="filter-select" data-placeholder="--Chọn Email--">Email</th>
                                            <th style="text-align:center" class="filter-select" data-placeholder="--Chọn số tài khoản--">Số tài khoản</th>
                                        </tr>
                                    </thead>

                                    <tbody>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </tbody>

                                    <tfoot>
                                        <th style="text-align: center" colspan="14" class="ts-pager form-horizontal tablesorter-pager" data-column="0">
                                            <label>Trang</label>
                                            <select class="pagenum input-mini" aria-disabled="false">
                                            </select>
                                            <button type="button" class="btn btn-xs first disabled" tabindex="0" aria-disabled="true"><i class="icon-step-backward glyphicon glyphicon-step-backward"></i></button>
                                            <button type="button" class="btn btn-xs prev disabled" tabindex="0" aria-disabled="true"><i class="icon-arrow-left glyphicon glyphicon-backward"></i></button>
                                            <span class="pagedisplay"></span>
                                            <button type="button" class="btn btn-xs next" tabindex="0" aria-disabled="false"><i class="icon-arrow-right glyphicon glyphicon-forward"></i></button>
                                            <button type="button" class="btn btn-xs last" tabindex="0" aria-disabled="false"><i class="icon-step-forward glyphicon glyphicon-step-forward"></i></button>
                                        </th>
                                    </tfoot>
                                </table>
                          </LayoutTemplate>

                          <ItemTemplate>
                                <tr runat="server" class="warning">
                                    <td style="text-align: center"><%# Eval("Rows_ID") %></td>
                                    <td style="text-align:left">
                                        <asp:LinkButton ID="link_Alias" CommandName="_Add" Text='<%# Eval("Customer_Alias") %>' runat="server"></asp:LinkButton>
                                    </td>
                                    <td style="text-align:left">
                                         <asp:LinkButton ID="link_Name" CommandName="_Add" Text='<%# Eval("Customer_Name") %>' runat="server"></asp:LinkButton>
                                    </td>
                                    <td style="text-align:right">
                                        <asp:LinkButton ID="link_Phone" CommandName="_Add" Text='<%# Eval("Customer_Phone1") %>' runat="server"></asp:LinkButton>
                                    </td>
                                    <td style="text-align:left">
                                        <asp:LinkButton ID="link_Mail" CommandName="_Add" Text='<%# Eval("Contact_Email") %>' runat="server"></asp:LinkButton>
                                    </td>
                                    <td style="text-align:right">
                                         <asp:LinkButton ID="link_Account_Number" CommandName="_Add" Text='<%# Eval("Customer_Account_Number") %>' runat="server"></asp:LinkButton>
                                    </td>
                                    <td style="text-align: center;display:none">
                                        <asp:LinkButton ID="btnAddCustomerlist" CommandName="_Add"  CssClass="btn btn-default btn-xs" runat="server">Chọn</asp:LinkButton>
                                    </td>
                                    <td style="text-align: center;display:none">
                                        <asp:Label ID="lbIDCus"  runat="server" Text='<%# Eval("Customer_ID") %>'></asp:Label>
                                    </td>
                                </tr>
                          </ItemTemplate>

                          <EmptyDataTemplate>
                                <div class='alert alert-danger'>
                                    <a href='#' class='close' data-dismiss='alert'>&times;</a>
                                    Không tìm thấy mẫu tin nào !
                                </div>
                          </EmptyDataTemplate>
                       </asp:ListView>
                 </div>
             </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearchCustomer" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="btnReloadCustomer" EventName="Click" />
        </Triggers>
    </asp:UpdatePanel>
</div>
<!--------------Kêt-thúc----------------->

<!-------------Detail-Dữ-Liệu-------------->
<div id="detailmaterials" title="Chi tiết đơn đặt hàng">
    <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
        <ContentTemplate>
            <div style="display:none"><asp:Label ID="lbIdDetailMaterial_" runat="server" Text="Label"></asp:Label></div>
            <div style="display:none"><asp:Label ID="lbIsActive" runat="server" Text=""></asp:Label></div>
            <div class="div-titile-order">CHI TIẾT ĐƠN ĐẶT HÀNG</div>
            <div class="div-titile-order-customer-name-left">Chứng từ:</div>
            <div class="div-titile-order-customer-name-right">
                <asp:Label ID="lbOrderCode" runat="server" Text=""></asp:Label>
            </div>

            <div class="div-titile-order-customer-name-left">Mã khách hàng:</div>
            <div class="div-titile-order-customer-name-right">
                <asp:Label ID="lbCustomer_Code" runat="server" Text=""></asp:Label>
            </div>

            <div class="div-titile-order-customer-name-left">Tên khách hàng:</div>
            <div class="div-titile-order-customer-name-right">
                <asp:Label ID="lbCustomerName" runat="server" Text=""></asp:Label>
            </div>

            <div class="div-titile-order-customer-name-left">Ngày đặt hàng:</div>
            <div class="div-titile-order-customer-name-right">
                <asp:Label ID="lbDateBegin" runat="server" Text=""></asp:Label>
            </div>

            <div class="ui-main-order-grid-order-detail">
            <div class="table-responsive">
            <asp:ListView ID="ListViewOrderDetail" runat="server" DataKeyNames="Order_Detail_Id"  OnItemCanceling="ListViewOrderDetail_ItemCanceling" OnItemDeleting="ListViewOrderDetail_ItemDeleting" OnItemEditing="ListViewOrderDetail_ItemEditing1"  OnItemUpdating="ListViewOrderDetail_ItemUpdating" Visible="true">
                <LayoutTemplate>
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th style="text-align: center">STT</th>
                                <th style="text-align:center">Mã vật tư</th>
                                <th style="text-align:center">Số lượng</th>
                                <th style="text-align:center">Đơn giá</th>
                                <th style="text-align:center">% CK</th>
                                <th style="text-align:center">Tiền CK</th>
                                <th style="text-align:center">% VAT</th>
                                <th style="text-align:center">Tiền VAT</th>
                                <th style="text-align:center">Tổng tiền</th>
                                <th style="text-align:center;display:none">Chức năng</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </tbody>
                    </table>
                </LayoutTemplate>

                <ItemTemplate>
                    <tr runat="server" class="warning">
                        <td>
                            <asp:Label ID="lbRowsID" runat="server" Text='<%# Eval("Rows_ID") %>' />
                            <asp:Label ID="lbID" Visible="false" runat="server" Text='<%# Eval("Order_Detail_Id") %>' />
                            <asp:Label ID="lbIDMaterials_Id" Visible="false" runat="server" Text='<%# Eval("Materials_Id") %>' />
                        </td>

                        <td>
                            <asp:Label ID="lbMaVatTu" runat="server" Text='<%# Eval("Materials_Name") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lbSoLuong" runat="server" Text='<%# Eval("Order_Detail_Quality") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lbDonGia" runat="server" Text='<%# Eval("Order_Detail_Price","{0:0,00}") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lb_lst_ck_percent" runat="server" Text='<%# Eval("Order_Detail_CK_Percent") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lb_lst_ck" runat="server" Text='<%# Eval("Order_Detail_CK") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lb_lst_vat_pertcent" runat="server" Text='<%# Eval("Order_Detail_VAT_Percent") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lb_lst_vat" runat="server" Text='<%# Eval("Order_Detail_VAT") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="lbThanhTien" runat="server" Text='<%# Eval("Order_Detail_Total_Price","{0:0,00}") %>' />
                        </td>

                        <td style="text-align:center;display:none">
                            <asp:Button ID="DeleteButton" Visible="false" CssClass="btn btn-default btn-sm btn-xs" runat="server" CommandName="Delete" Text="Xoá dòng" />
                            <asp:Button ID="EditButton" CssClass="btn btn-default btn-sm btn-xs" runat="server" CommandName="Edit" Text="Thay đổi" />
                        </td>
                    </tr>
                </ItemTemplate>

                <EditItemTemplate>
                    <tr style="">
                        <td>
                            <asp:Label ID="lbRow_ID" runat="server" Visible="true" Text='<%# Eval("Rows_ID") %>' />
                            <asp:Label ID="lbID" runat="server" Visible="false" Text='<%# Eval("Order_Detail_Id") %>' />
                        </td>

                        <td>
                            <asp:Label ID="lbMaVatTu" runat="server" Text='<%# Eval("Materials_Name") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtSoLuong" onkeypress="return ValidateKeypress(/\d/,event);" CssClass="text-num text-num-order" runat="server" Text='<%# Bind("Order_Detail_Quality") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtDonGia" onkeyup="this.value=FormatNumber(this.value);" CssClass="text-num text-num-order-1" runat="server" Text='<%# Bind("Order_Detail_Price","{0:0,00}") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtCKPercent" onkeypress="return ValidateKeypress(/\d/,event);" CssClass="text-num text-num-order-1" runat="server" Text='<%# Bind("Order_Detail_CK_Percent") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtCK" Enabled="false" onkeypress="return ValidateKeypress(/\d/,event);" CssClass="text-num text-num-order-1" runat="server" Text='<%# Bind("Order_Detail_CK") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtVATPercent" onkeypress="return ValidateKeypress(/\d/,event);" CssClass="text-num text-num-order-1" runat="server" Text='<%# Bind("Order_Detail_VAT_Percent") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtVAT" Enabled="false" onkeypress="return ValidateKeypress(/\d/,event);" CssClass="text-num text-num-order-1" runat="server" Text='<%# Bind("Order_Detail_VAT") %>' />
                        </td>

                        <td style="text-align:center">
                            <asp:TextBox ID="txtThanhTien" Enabled="false" CssClass="text-num text-num-order-1" runat="server" Text='<%# Bind("Order_Detail_Total_Price","{0:0,00}") %>' />
                        </td>

                        <td style="text-align:center;display:none">
                            <asp:Button ID="UpdateButton" CssClass="btn btn-default btn-xs" runat="server" CommandName="Update" Text="Cập nhật" />
                            <asp:Button ID="CancelButton"  CssClass="btn btn-default btn-xs" runat="server" CommandName="Cancel" Text="Bỏ qua" />
                        </td>
                    </tr>
                </EditItemTemplate>
            </asp:ListView>
            </div>
            </div>
            <div class="div-bttn">
                <asp:RadioButton ID="rdAgree" GroupName="A" Text="Đồng ý" AutoPostBack="true" runat="server" />
                <asp:RadioButton ID="rdCancel" GroupName="A" Text="Bỏ qua" AutoPostBack="true" runat="server" />
                <asp:LinkButton ID="btnAgree" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnAgree_Click">Đồng ý</asp:LinkButton>
                <asp:LinkButton ID="btnCancel" CssClass="btn btn-default btn-sm" runat="server" OnClick="btnCancel_Click">Huỷ bỏ</asp:LinkButton>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>   
</div>
<!--------------Kêt-thúc----------------->
</asp:Content>